<?php

// 4/25/2010: immanuel192 write this action to return bible verse 

if (!defined('EXPONENT')) exit('');

global $db;
// get t2 value, just for fun
$t2=$_GET['t2'];
$id = -1;
if (isset($_REQUEST['book']) && isset($_REQUEST['chapter']) && isset($_REQUEST['translation']))
{
	$translation = intval($_REQUEST['translation']);
	// get translation short name
	$bible=$db->selectObject("bibles","id = " . $translation);
	if ($bible == null) 
	{
		die();
	}
	else
	{
		$short_name = $bible->short_name;
		$book=intval($_REQUEST['book']); $chapter=intval($_REQUEST['chapter']);
		$show_as =0;
		if (isset($_REQUEST['show_as']))
			$show_as=intval($_REQUEST['show_as']);
	
		$data=$db->selectObjects("bible_".$short_name,"book = {$book} AND chapter = {$chapter} ORDER BY verse");
		$html="";
		foreach ($data as $k=>$v)
		{
			$html.="<span id='v{$v->verse}'>{$v->verse}</span>&nbsp;";
			$html.=$v->bibletext . "&nbsp;";
			if ($show_as==1)
				$html.="<br>";
		}
		$html.="<br>";
		echo $t2; echo $html;	
	}
}
else
{
	die();
}
?>
